PutBucketLogging
Description
Bucket owner can enable access logging for Bucket. After this function is enabled, OSS automatically records the details of requests to access this bucket, and writes the access log as an object to the bucket specified by the user in hours according to the rules specified by the user.
Request Method
POST
Request Path
/apsara/route/OneRouter/PutBucketLogging
Request Parameters Common Parameters
Name | Location | Type | Required | Sample value | Description |
---|---|---|---|---|---|
BucketLoggingStatus | BODY | container | Yes | not involved | container for accessing log status information. |
TargetPrefix | BODY | string | No | MyLog- | specifies the final saved access log file prefix. |
regionId | BODY | string | Yes | No sample value for this parameter. | region id |
TargetBucket | BODY | string | No | doc-log | specifies the bucket on which access logs are stored. |
version | BODY | string | No | 2016-01-01 | version of api |
LoggingEnabled | BODY | container | No | not involved | container for accessing log information. This element is needed when it is turned on and not when it is turned off. |
Return data
Name | Type | Sample value | Description |
---|---|---|---|
LoggingFlag | true | no demo value | whether the access log function is enabled. |
Remote IP | 119.140.142.11 | no demo value | request initiated IP address (Proxy proxy or user firewall may block this field). |
Referer | http://www.aliyun.com/product/oss | no demo value | the requested HTTP Referer. |
User-Agent | curl/7.15.5 | no demo value | HTTP User-Agent header. |
ObjectSize | 5576 | no demo value | Object size. |
Sync Request | - | no demo value | is it a CDN back-to-source request; if it is not -. |
Time | [02/may/2012:00:00:04 +0800] | no demo value | The time when OSS received the request. |
Request-URI | "get /aliyun-logo.png http/1.1" | no demo value | URI (including query-string) requested by the user. |
Request ID | 505b01695037c2af032593a4 | no demo value | UUID used to uniquely identify the request. |
Operation | getobject | no demo value | request type. |
RequestTime (ms) | 71 | no demo value | the time (in milliseconds) to complete this request. |
Server Cost Time (ms) | 17 | no demo value | The time (milliseconds) taken by the OSS server to process this request. |
Error Code | nosuchbucket | no demo value | The error code returned by OSS. |
Request Length | 302 | no demo value | The length of the user request (Byte). |
SentBytes | 5576 | no demo value | Traffic downloaded by users from OSS. |
Bucket | oss-example | no demo value | the name of the bucket to be accessed. |
UserID | 1657136103983691 | no demo value | Bucket owner ID. |
Requester Aliyun ID | 1657136103983691 | no demo value | Aliyun ID of the requester; - when accessing anonymously. |
HTTP Status | 200 | no demo value | HTTP status code returned by OSS. |
HostName | oss-example.regionid.example.com | no demo value | request to access the domain name. |
Key | /aliyun-logo.png | no demo value | Key requested by the user. |
Reserved | - | no demo value | reserved fields. |
Delta DataSize | 280 | no demo value | Bucket size change; if there is no change to -. |
Example
Successful Response example
{
"LoggingFlag":"no demo value",
"Remote IP":"no demo value",
"Referer":"no demo value",
"User-Agent":"no demo value",
"ObjectSize":"no demo value",
"Sync Request":"no demo value",
"Time":"no demo value",
"Request-URI":"no demo value",
"Request ID":"no demo value",
"Operation":"no demo value",
"RequestTime (ms)":"no demo value",
"Server Cost Time (ms)":"no demo value",
"Error Code":"no demo value",
"Request Length":"no demo value",
"SentBytes":"no demo value",
"Bucket":"no demo value",
"UserID":"no demo value",
"Requester Aliyun ID":"no demo value",
"HTTP Status":"no demo value",
"HostName":"no demo value",
"Key":"no demo value",
"Reserved":"no demo value",
"Delta DataSize":"no demo value"
}
Failed Response example
{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}
}